Imports AutoMapper
Imports System.Runtime.CompilerServices


Public Module MapperExtensions

    <Extension()>
    Public Function MapTo(Of TSource, TDestination)(ByVal one As TSource) As TDestination
        Return Mapper.Map(Of TSource, TDestination)(one)
    End Function

    <Extension()>
    Public Function MapListTo(Of TSource, TDestination)(ByVal one As IEnumerable(Of TSource)) As IEnumerable(Of TDestination)
        Return Mapper.Map(Of IEnumerable(Of TSource), IEnumerable(Of TDestination))(one)
    End Function

    <Extension()>
    Public Sub AssignFrom(Of TSource, TDestination)(ByVal dest As TDestination, ByVal source As TSource)
        Mapper.Map(Of TSource, TDestination)(source, dest)
    End Sub

End Module
